import java.util.Arrays;

public class xuanzepaixu {
    public static void main(String[] args) {
        int [] data ={5,2,3,4,1,6,10,121,8};
        selectSort(data);

    }
    public static void selectSort(int[]data){
        if (data==null||data.length<=0){
            return;
        }
        for (int i = 0; i < data.length; i++) {
            int MinKey = data[i];
            for (int j = i; j < data.length; j++) {
                if (MinKey>data[j]){
                    int tep = data[j];
                    data[j] = MinKey;
                    MinKey = tep;
                }
            }
            data[i] =MinKey;
            System.out.println(Arrays.toString(data));
        }
    }
}

